﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace YawcamHideShowTesting
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private WindowsWindow yawcamWindow;
        bool visibility = true;
        
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button_Hide_Click(object sender, RoutedEventArgs e)
        {
            if (visibility == true)
            {
                WindowsWindows wndList = new WindowsWindows(false, false);
                foreach (WindowsWindow wnd in wndList)
                {
                    //Console.Out.WriteLine(wnd.Title);
                    if (wnd.Title.Contains("Preview"))
                    {
                        //Console.Out.WriteLine(wnd.Title);
                        wnd.Visible = false;
                        visibility = false;
                        yawcamWindow = wnd;
                    }
                }
            }
        }

        private void button_Show_Click(object sender, RoutedEventArgs e)
        {
            if (visibility == false)
            {
                yawcamWindow.Visible = true;
                visibility = true;
            }
        }
    }
}
